package com.hncj.yqfk.utils;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

import java.util.Date;

public class JsonResult<T> extends ResponseEntity<Message> {

    public JsonResult(HttpStatus status) {
        super(status);
    }

    public JsonResult(Integer code, Date time,String errormessage, T data) {
        super(Message.custom(code, errormessage,time, data), Message.num2HttpStatus(code));
    }

    public JsonResult(Integer code, Date time,String errormessage) {
        super(Message.custom(code,errormessage,time), Message.num2HttpStatus(code));
    }
    public static <T> JsonResult<T> custom(Integer code,String errormessage, Date time, T data) {
        return new JsonResult(code,time,errormessage,data);
    }
}
